<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //1.把数字型转换为字符串型  变量.toString()
        var age = 22;
        var str = age.toString();
        console.log(typeof str);

        //2.String(变量)强制转化
        var str1=String(age);
        console.log(typeof str1);
        //3.利用+拼接字符串的方法实现转换效果 隐式转换
        console.log(123+"");
        console.log(age);//控制台中，string是黑色，number是蓝色
       
       //4.propt()接收的数据都是字符串
       var score = prompt('请输入你的成绩');
       console.log(typeof score);
   
   </script>
</head>
<body>
    
</body>
</html>